package com.itsm.example.audit.pojo.dto;

/**
 * @author lipengak
 * @description 公共返回码
 * @date 2024-08-27 11:08 AM
 */
public enum ResultCode {

    //成功
    SUCCESS(true,200, "操作成功", "Success"),

    //系统错误信息以1开头:数据库连接异常，系统错误，token无效，非法访问等
    FAIL(10001, "操作失败", "Fail"),
    SYS_ERR(10002, "系统错误,请稍后重试！", "System Error"),
    RESOURCE_NOT_EXIST(10404, "访问的资源不存在！", " PATH NOT EXIST"),
    REQUEST_DENY(10403, "您的访问被拒绝", " ACCESS DENY"),
    REQUEST_NO_PERMISSION(10401, "权限不足", "NO PERMISSION"),
    LOGIN_TIME_OUT(11401, "登陆过期", "LOGIN TIME OUT"),
    LOGIN_TOKEN_INVALID(11601, "TOKEN无效", "TOKEN INVALID"),
    LOGIN_INFO_INVALID(11602, "用户名或者密码错误", "LOGIN FAILED"),
    LICENSE_INFO_INVALID(11603, "证书失效", "LICENSE INVALID"),
    VALIDATE_CODE_INVALID(11604, "验证码错误", "VALIDATE CODE INVALID"),




    //业务模块错误信息以2-6开头
    GEOG_NOT_EXIST(20001, "服务号对应的地理信息不存在", " Wechat geog not exist"),
    USER_CONCERNED(30001, "用户已关注当前工单,请勿重复操作", "Current User Have Concern WorkOrder"),
    USER_NOT_CONCERNED_ERR(30002, "当前用户未关注该工单，无法取消关注", "Not Concern Can't Cancel"),
    USER_COPY_ADD_FAIL(30003, "新增用户抄送失败", "Add Copy User Fail"),
    USER_COPY_DEL_FAIL(30004, "删除用户抄送失败", "Del User Copy Fail"),
    LICENSE_FAIL(40002, "该项目不存在License", "License Fail"),

    // 第三方应用错误相关以7-9开头：微信、钉钉
    CORP_MSG_PARAM_ERR(70020, "请求参数不完整", "Request params error"),
    WX_TOKEN_FAIL(80001, "服务号获取TOKEN失败", "Wechat get token fail"),
    WX_APP_ID_NULL(80002, "APPID不能为空", "APPID can not null"),
    WX_APP_SECRET_NULL(80003, "服务号Secret不能为空", "Wechat secret can not null"),
    WX_GEOG_NOT_EXIST(80004, "服务号配置不存在", "Wechat config not exist"),
	THIRD_INCINFO_NOT_EXIST(false, 90001, "工单信息不存在", "Incident info not exist");


    //操作是否成功
    boolean success;
    //操作代码
    int code;
    //提示信息
    String msg;
    //英文提示信息
    String enMsg;

    ResultCode(boolean success, int code, String message, String enMsg){
        this.success = success;
        this.code = code;
        this.msg = message;
        this.enMsg = enMsg;
    }
    ResultCode(int code, String message, String enMsg){
        this.success = false;
        this.code = code;
        this.msg = message;
        this.enMsg = enMsg;
    }

    public String msg(){
        return msg;
    }

    public Integer getErrCode(){
        return code;
    }
    public String getErrMsg(){
        return msg;
    }

    public boolean isSuccess() {
        return success;
    }
}
